<?php
set_time_limit(0);
require './framework/class/class_core.php';
$lab = & core::instance();
$lab->init();

//var_dump($lab);

//$i = 0;
$start = 0;
/*
for($i = $start; $i < 2000; $i ++) {
	$name = random(7);
	$email = random(7)."@gmail.com";
	$pw = '111111';//exit($pw);
	$id = member::register($email, $name, $pw, $pw, false);
	if($id < 0) {
		var_dump($id);
		exit();
	}
}*/
include libfile('class/friend');
for($i = $start; $i < 90; $i ++) {
	$uid = 1;
	$friendid = $i + 2;
	list($friendid, $uid) = array($uid, $friendid);
	$id = friendmodel::add($uid, $friendid);
}

function getarr($oid, $array) {
	if(!is_array($array)) $array = array($array);
	$key = array_search($oid, $array);
	if(!$key) return array();
	else {
		$u = $key - 2;
		$i = $u < 0 ? 0 : $u;
		$len = $u < 0 ? $u + 2 : 4;
		$return = array_slice($array, $i, $len); 
		return $return;
	}
}

echo "OK";